package com.bifang.core.dao.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * 任务详细信息
 *
 * @author chenzh
 * @since 2020-09-26
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("QRTZ_JOB_DETAILS")
@ApiModel(value = "QrtzJobDetails对象", description = "任务详细信息")
public class QrtzJobDetails extends Model<QrtzJobDetails> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "调度名称")
    @TableId(value = "SCHED_NAME", type = IdType.INPUT)
    private String schedName;

    @ApiModelProperty(value = "集群中job的名字")
    @TableField("JOB_NAME")
    private String jobName;

    @ApiModelProperty(value = "集群中job的所属组的名字")
    @TableField("JOB_GROUP")
    private String jobGroup;

    @ApiModelProperty(value = "描述")
    @TableField("DESCRIPTION")
    private String description;

    @ApiModelProperty(value = "集群中job实现类的完全包名")
    @TableField("JOB_CLASS_NAME")
    private String jobClassName;

    @ApiModelProperty(value = "是否持久化,把该属性设置为1，quartz会把job持久化到数据库中")
    @TableField("IS_DURABLE")
    private String isDurable;

    @ApiModelProperty(value = "是否并发")
    @TableField("IS_NONCONCURRENT")
    private String isNonconcurrent;

    @ApiModelProperty(value = "是否更新数据")
    @TableField("IS_UPDATE_DATA")
    private String isUpdateData;

    @ApiModelProperty(
            value =
                    "是否接受恢复执行，默认为false，设置了RequestsRecovery为true，因故障重新提交之后Quartz会检测当前的任务时候错过了应该触发的时间，如果错过了会立即触发一个任务")
    @TableField("REQUESTS_RECOVERY")
    private String requestsRecovery;

    @ApiModelProperty(value = "一个blob字段，存放持久化job对象")
    @TableField("JOB_DATA")
    private byte[] jobData;

    @Override
    public Serializable pkVal() {
        return this.schedName;
    }
}
